import Main from "../pages/main.js";
import Login from "../pages/login.js";

import classRoutes from "./classes/classes.js"
import studentRoutes from "./student/student.js";




//配置前端路由的规则
var routes = {
    //键：url地址 值（函数）：对应的现实的界面
    "/login":()=>{
        new Login();
    },
    "/main":{
        ...classRoutes,
        ...studentRoutes,
    //防止主界面重复渲染
    
        on:()=>{
            console.log($("#showcontent").length);
            if($("#showcontent").length==0){
                new Main()
            }
          
        }
    },
  };
  //配置路由
//   var router = Router(routes);
//二级路由
var router = Router(routes).configure({ recurse: 'forward' });

  //初始化路由
  router.init();
  //设置根目录对应的路径 ---> #/login
  window.location.hash=  window.location.hash ||"#/login";
